//////////////////////////////////////////////////////////////
//
//  Description	: PDF2HTML/BMP software
//  Author	: verypdf.com Inc
//  Version	: Ver1.2
//  Platform	: Windows95/98/Me/NT/2000/XP
//  Environment	: Visual C++ 6.0
//  Date	: 2002/04/03
//
//  Copyright(C) 2000--2003 verypdf.com Inc
//      
//  Contact infomation:
//        http://www.verypdf.com/
//        support@verypdf.com
//
//  This program is shareware; you can redistribute and/or 
//  modify it under the terms of the GNU General Public License.
//  See the GNU General Public License for more details.
//
//               Portion base on Xpdf code
//         Copyright 1996-2003 Glyph && Cog, LLC
//////////////////////////////////////////////////////////////

#ifndef PBMOUTPUTDEV_H
#define PBMOUTPUTDEV_H

#ifdef __GNUC__
#pragma interface
#endif

#include <stddef.h>
#include "config.h"
#include "XOutputDev.h"

//------------------------------------------------------------------------

class PBMOutputDev: public XOutputDev 
{
public:
	static PBMOutputDev *makePBMOutputDev(char *displayName,char *fileRootA);
	static void killPBMOutputDev(PBMOutputDev *out);
	virtual ~PBMOutputDev();
	
	//----- initialization and control
	int getWidth()	{return	width;}
	int getHeight()	{return height;}
	int getCurPage(){return curPage;}

	// Start a page.
	virtual void startPage(int pageNum, GfxState *state);
	// End a page.
	virtual void endPage();
	void drawImageMask(GfxState *state, Object *ref, Stream *str,
				   int width, int height, GBool invert,
				   GBool inlineImg);
	void drawImage(GfxState *state, Object *ref, Stream *str,
			       int width, int height,
			       GfxImageColorMap *colorMap, 
			       int *maskColors,GBool inlineImg);

	TextPage *getPageText(){return text;}
	vector<SHTMLINK> *getHtmLink(){return &m_aryHtmLink;}
private:
	
	PBMOutputDev(Display *displayA, int screenA,
		Pixmap pixmapA, Window dummyWinA,
		int invertA, char *fileRootA);
	
	char *fileRoot;
	char *fileName;
	int curPage;
	
	GBool dumpJPEG;		// set to dump native JPEG files
	int imgNum;			// current image number

	Display *display;
	int screen;
	Pixmap pixmap;
	Window dummyWin;
	int width, height;
	int invert;
};

#endif
